package com.mr.qa.dao.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mr.qa.bo.ShopCategory;


public class ShopCategoryDAO extends BaseHibernateDAO {
	
	private static final Log log = LogFactory.getLog(SharedFileDAO.class);
	
	public void save(ShopCategory transientInstance) 
    {
        try 
        {
            getSession().save(transientInstance);
        }
        catch(RuntimeException re) 
        {
            throw re;
        }
    }
	
	public void modify(ShopCategory transientInstance) 
    {
        try 
        {
            getSession().update(transientInstance);
        }
        catch(RuntimeException re) 
        {
            throw re;
        }
    }

    
    public void delete(ShopCategory persistentInstance) 
    {
        log.debug("deleting ShopCategory instance");
        try 
        {
            getSession().delete(persistentInstance);
            log.debug("delete successful");
        }
        catch (RuntimeException re) 
        {
            log.error("delete failed", re);
            throw re;
        }
    }
    
    public ShopCategory findById(Integer id) {
        try {
        	ShopCategory instance = (ShopCategory) getSession()
                    .load("com.mr.qa.bo.ShopCategory", id);
            return instance;
        } catch (RuntimeException re) {
            throw re;
        }
    }
	
	public List getAvaiCategories(){
		String sql = "from ShopCategory";
		return this.getQueryList(sql, null);
	}
	
}
